import { GSprite } from "./GSprite";
import { ICellRenderer } from "../../../fl/controls/listClasses/ICellRenderer";
import { IToolTipItem } from "../manager/IToolTipItem";
import { Global } from "../../gengine/global/Global";
import { ToolTipsManager } from "../manager/ToolTipsManager";
import { ListData } from "../../../fl/controls/listClasses/ListData";
//class GCellRenderer
    
    export  class GCellRenderer extends GSprite implements ICellRenderer, IToolTipItem
    {
        constructor()
        {
            
            super();this.addEventListener(flash.events.Event.ADDED_TO_STAGE, this.onAddedToStageHandler);
            this.addEventListener(flash.events.Event.ADDED_TO_STAGE, this.judgeToolTip);
            this.addEventListener(flash.events.Event.REMOVED_FROM_STAGE, this.judgeToolTip);
            return;
        }

        protected judgeToolTip(arg1: Object /* flash.events.Event */=null): void
        {
            if (arg1 && arg1.type == flash.events.Event.ADDED_TO_STAGE && this.toolTipData || !arg1 && this.toolTipData && Global.stage.contains(this)) 
            {
                ToolTipsManager.register(this);
            }
            else 
            {
                ToolTipsManager.unregister(this);
            }
            return;
        }

        protected onAddedToStageHandler(arg1: Object /* flash.events.Event */): void
        {
            this.removeEventListener(flash.events.Event.ADDED_TO_STAGE, this.onAddedToStageHandler);
            this.mouseChildren = true;
            this.mouseEnabled = true;
            return;
        }

        public setSize(arg1: number, arg2: number): void
        {
            return;
        }

        protected /* override */ configUI(): void
        {
            super.configUI();
            return;
        }

        protected draw(): void
        {
            return;
        }

        public get listData(): ListData
        {
            return this._listData;
        }

        public set listData(arg1: ListData)
        {
            this._listData = arg1;
            return;
        }

        public get data(): Object
        {
            return this._data;
        }

        public set data(arg1: Object)
        {
            this._data = arg1;
            return;
        }

        public get selected(): Boolean
        {
            return this._selected;
        }

        public set selected(arg1: Boolean)
        {
            this._selected = arg1;
            return;
        }

        public setMouseState(arg1: string): void
        {
            return;
        }

        public get toolTipData()
        {
            return this._toolTipData;
        }

        public set toolTipData(arg1)
        {
            this._toolTipData = arg1;
            this.judgeToolTip();
            return;
        }

        public setStyle(arg1: string, arg2: Object): void
        {
            return;
        }

        protected /* var */_listData: ListData;

        protected /* var */_selected: Boolean;

        protected /* var */_data: Object;

        private /* var */_toolTipData;
    }
